<template>
	<div class="my-app details">
		<h2 class="my-h2">订单详情</h2>
		<div class="my-form-item">
			<h3 style="color: #ff6600;text-align: left;padding-bottom: 10px;">订单ID：{{settleorderDetail.order_id}}</h3>
			<com-table :ComTable="ComTable" @ComTablesondata="ComTablesondata"></com-table>
		</div>
		<div class="my-button">
				<el-button class="submit" @click="returngo">返回订单列表</el-button>
		</div>
	</div>
</template>

<script>
	import {
		mapGetters,
		mapActions
	} from 'vuex'
	export default {
		name: "",
		data() {
			return {

				ComTable: {
					header: "headercolor",
					title: [{
						label: '名目',
						prop: 'a',
						width: '200px'
					}, {
						label: '内容',
						prop: 'b',
						type: 'list'
					}, ],
					tableData: [{
						a: '订单ID',
						name: "order_id",
						b: [],
						rowclass: "a"
					}, {
						a: '下单日期',
						name: "insert_time",
						b: []
					}, {
						a: '下单人',
						name: "contacts",
						b: []
					}, {
						a: '联系方式',
						name: "phone",
						b: []
					}, {
						a: '购买产品名称',
						name: "goods_info",
						b: []
					}, {
						a: '订单金额',
						name: "money",
						b: []
					}, {
						a: '订单人数',
						name: "people_number",
						b: []
					}, {
						a: '实付金额',
						name: "real_money",
						b: []
					}, {
						a: '订单车辆',
						name: "car_number",
						b: []
					}, {
						a: '车辆牌照',
						name: "car",
						b: []
					}, {
						a: '订单核销时间',
						name: "check_time",
						b: []
					}, ],
					multipleSelection: []
				},
			}
		},
		computed: {
			...mapGetters([
				'token',
				'ReqsettleorderDetail',
				'settleorderDetail'
			])
		},
		created() {
			this.SetsettleorderDetail()
		},
		methods: {
			...mapActions({
				getsettleorderDetail: 'getsettleorderDetail',
			}),
			ComTablesondata(i) {

			},
			returngo(){
				this.$router.go(-1)
			},
			SetsettleorderDetail() {
				this.ReqsettleorderDetail.token = this.token;
				this.$api.GetsettleorderDetail(this.ReqsettleorderDetail)
					.then(res => {
						if (res.code === 200) {
							this.getsettleorderDetail(res.result)
							for (var i = 0; i < this.ComTable.tableData.length; i++) {
								for (var key in this.settleorderDetail) {
									if (this.ComTable.tableData[i].name === key) {
										if (typeof(this.settleorderDetail[this.ComTable.tableData[i].name]) === 'object') {
											this.ComTable.tableData[i].b = this.settleorderDetail[this.ComTable.tableData[i].name];
										} else {
											this.ComTable.tableData[i].b[0] = this.settleorderDetail[this.ComTable.tableData[i].name];

										}
									}
								}
							}
						}
					})
			}
		}
	}
</script>

<style>
</style>
